import { defineConfig,loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url' // 使用现代Node.js的URL模块

// https://vitejs.dev/config/
export default defineConfig(({mode})=>{
  const env = loadEnv(mode, process.cwd(), ''); 
  const BASE_PATH = env.VITE_API_BASE_PATH;
  return {
    plugins: [vue()],
    base: BASE_PATH + "/",
    build: {
      assetsDir:'assets'
    },
    resolve: {
      alias: {
        '@': fileURLToPath(new URL('./src', import.meta.url)),
        '@components': fileURLToPath(new URL('./src/components', import.meta.url))
      }
    }
  }
})